function hasSameWord(str1, str2) {
    if (str1.length != str2.length) return false
    let obj = {}
    for (let i = 0; i < str1.length; i++) {
        obj[str1[i]] ? obj[str1[i]]++ : obj[str1[i]] = 1;
        obj[str2[i]] ? obj[str2[i]]-- : obj[str2[i]] = -1
    }

    return Object.values(obj).every(v => v === 0)

}

console.log(hasSameWord("jiao","oaij5"))